package su.samcom.calc.model.entity;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: Владислав
 * Date: 19.11.13
 * Time: 23:25
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "calc_samcom_su.price")
public class Price implements Serializable {
    private static final long serialVersionUID = -1300048692173003089L;

    private Long id;
    private String name;
    private Double cbm;
    private Double weight;
    private Double length;
    private Integer price;
    private PriceGroup priceGroup;

    @Id
    @SequenceGenerator(name = "price_gen", sequenceName = "calc_samcom_su.price_seq", allocationSize = 1)
    @GeneratedValue(generator = "price_gen", strategy = GenerationType.SEQUENCE)
    @Column(name = "id")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "cbm")
    public Double getCbm() {
        return cbm;
    }

    public void setCbm(Double cbm) {
        this.cbm = cbm;
    }

    @Column(name = "weight")
    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    @Column(name = "length")
    public Double getLength() {
        return length;
    }

    public void setLength(Double length) {
        this.length = length;
    }

    @Column(name = "price")
    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "price_group_id")
    public PriceGroup getPriceGroup() {
        return priceGroup;
    }

    public void setPriceGroup(PriceGroup priceGroup) {
        this.priceGroup = priceGroup;
    }
}
